﻿using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace XiaoYuJi.EntityFrameworkCore.Migrations
{
    public partial class UserAddFieldRoleId_v12 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "Sys_User",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<int>(
                name: "RoleId",
                table: "Sys_User",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "Sys_Role",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "Sys_Menu",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<bool>(
                name: "IsDelete",
                table: "Pictures",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.CreateIndex(
                name: "IX_Sys_User_RoleId",
                table: "Sys_User",
                column: "RoleId");

            migrationBuilder.AddForeignKey(
                name: "FK_Sys_User_Sys_Role_RoleId",
                table: "Sys_User",
                column: "RoleId",
                principalTable: "Sys_Role",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_Sys_User_Sys_Role_RoleId",
                table: "Sys_User");

            migrationBuilder.DropIndex(
                name: "IX_Sys_User_RoleId",
                table: "Sys_User");

            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "Sys_User");

            migrationBuilder.DropColumn(
                name: "RoleId",
                table: "Sys_User");

            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "Sys_Role");

            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "Sys_Menu");

            migrationBuilder.DropColumn(
                name: "IsDelete",
                table: "Pictures");
        }
    }
}
